home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
programs
/
flyercalibrate
< prev
next >
Wrap
Text File
|
1995-02-28
|
12KB
|
495 lines
/* Flyer Auto-Calibration, Version 17-Dec-94, by SKell, NewTek Inc. */
OPTIONS RESULTS
numeric digits 12
/*-------------------------------------------------*/
/* You may need to adjust these "assigns" for your system" */
TOAST = ""
FLYER = "Flyer_Support/C/"
/*-------------------------------------------------*/
/* Lets make sure they're not installed yet. */
remlib("ToasterARexx.port")
remlib("rexxmathlib.library")
say "Flyer Auto-Calibration, Version 17-Dec-94"
say
say "This script must be in your Programs drawer."
say
say "Requires the following Flyer utilities:"
say FLYER'PlayClip'
say FLYER'SetFloobyCal'
say FLYER'CalibNew'
say FLYER'SetPlayMode'
say
address command
'cd >nil: 'TOAST
address
TestClip=""
/*------------------------------------------*/
if pos("ToasterARexx.port" , show('Ports'))=0 then do
say
say "Please wait for the Switcher to load."
address command
'run >nil: VideoToaster'
address
/* Wait for the Switcher to come up */
waitcount=0
do while pos("ToasterARexx.port" , show('Ports'))=0
address command
'wait 1'
address
waitcount = waitcount+1
if(waitcount > 40) then do
say "The Switcher Failed to Load!"
say "Maybe you want to try again?"
exit
end
end
end
addlib("ToasterARexx.port" , 0)
SWITCHER(TOWB)
/* The Switcher is now up and running */
/*------------------------------------------*/
/* calibrate the genlock */
say "Calibrating the Flyer Genlock."
address command
FLYER'calibnew >nil: GC'
'c:wait 2'
FLYER'SetFloobyCal >nil: 0 10 0 0' /* reset some stuff in the Flyer */
address
open(in,"ENV:CalibResult",'read')
instring = readln(in)
close(in)
parse value instring with result
if (result ~= 0.0) then do
say "Problem detected during Genlock calibration."
say "Error #"result
say "Please power down, and then try again."
GetOutaHere("If the problem persists, contact NewTek for help.")
end
/*------------------------------------------*/
/* See if an existing TestSignal clip exists. If so, use it. */
count=0
volume=1
do until((TestClip ~= "") | (volume=""))
volume=SWITCHER(FLYV,count,1) /* see what Flyer Video volumes exist */
count=count+1
if(volume ~= "") then do
clipname=value("volume")':TestSignal'
if(exists(clipname)) then TestClip=clipname
end
end
if(TestClip = "") then do
say "Creating a Flyer Test Clip"
TestClip=SWITCHER(FLY1) /* create a test clip */
if(TestClip="") then do
say "Unable to create a Test Clip on one of your Flyer drives."
say "If your Video drives are full,"
say " you may need to free up some space."
say "You may want to power down, and then try again."
GetOutaHere("If the problem persists, contact NewTek for help.")
end
say "Created "TestClip" test clip."
end
/**********************************/
address command
FLYER'playclip >nil: 0 0 0 'TestClip' 0 0 0 1 0'
address
SWITCHER(TOSW)
SWITCHER(M003)
SWITCHER(P003)
if(ConnectLoopBack()=FALSE) then do
/* see if the user ever did any autohue */
if(SWITCHER(STAT,DHUE) < 0) then do
/* The user has never AutoHued their Toaster, so set Digital Phase */
say "Calibrating the Toasters digital phase."
best=CaliDigitalPhase()
SWITCHER(DHUE,best+256)
SWITCHER(MKHS)
end
else do
/* is the current Digital Phase Error > 3 degrees = (65536*sine(error)) ?*/
if(abs(SWITCHER(DH3E)) > 3430) then do
SWITCHER(TOWB)
say "Do you have a video source connected to input 1 of your Toaster (Y/N)?"
pull myhair
if (left(myhair,1) ~= "N") then do
say "Your Toaster may need AutoHueing."
say "You should Quit this script, AutoHue the Toaster,"
say "and then run this script again."
say "Do you want to continue this script anyway (Y/N)?"
pull myhair
if (left(myhair,1) ~= "Y") then do
SWITCHER(TOSW)
SWITCHER(NOIQ)
SWITCHER(TOWB)
remlib("ToasterARexx.port")
exit
end
else do
say "WARNING!"
say "Because you have chosen to skip Toaster AutoHueing,"
say "your Flyers playback hue may not be calculated accurately."
end
end
say "Is it OK for me to adjust your Toaster Digital Hue (Y/N)?"
pull myhair
SWITCHER(TOSW)
if (left(myhair,1) ~= "N") then do
say "Calibrating the Toasters digital phase."
best=CaliDigitalPhase()
SWITCHER(DHUE,best)
SWITCHER(MKHS)
end
end
end
DigitalPhaseError = DeltaHue2Angle(SWITCHER(DH3E))
if(abs(DigitalPhaseError) > 5) then do
SWITCHER(TOWB)
say "Your Toaster has a Digital Hue error of "DigitalPhaseError" degrees."
say "So, the Flyer's playback phase may not be calibrated correctly!"
say "You should try AutoHueing your Toaster, and then repeat this script."
SWITCHER(TOSW)
end
end
/*------------------------------------------*/
say "Please wait. Calibrating the Flyer Record Phase."
SWITCHER(MDV2)
SWITCHER(PDV1) /* tell it to load into DV1 */
SWITCHER(PAT1) /* Generatate test signal into DV1 */
SWITCHER(MDV1)
SWITCHER(PDV1)
SWITCHER(TOWB)
/*******************/
/* Auto Record Hue */
address command
FLYER'CalibNew >nil: AR 2'
FLYER'SetPlayMode 0 PLAY'
address
open(in,"ENV:CalibResult",'read')
instring = readln(in)
close(in)
parse value instring with RecordPhaseError
/* check for number of degrees error */
if (abs(RecordPhaseError) > 3) then do
say "Problem detected during Flyer Record Phase calibration."
say "Record Phase error ="RecordPhaseError" degrees."
say "Please power down, and then try again."
GetOutaHere("If the problem persists, contact NewTek for help.")
end
/******************/
/*------------------------------------------*/
SWITCHER(TOSW)
say "Calibrating the Flyers Playback Phase on channel 0."
Play0PhaseError=CalibratePlay(0)
say "Calibrating the Flyers Playback Phase on channel 1."
Play1PhaseError=CalibratePlay(1)
address command
'echo >ENV:FlyerCalibResults 'DigitalPhaseError RecordPhaseError Play0PhaseError Play1PhaseError
/* 'type ENV:FlyerCalibResults' */
address
GetOutaHere("Flyer Calibration was successful.")
exit
/******************************************************************/
/******************************************************************/
CalibratePlay:
arg VidChannel
if(VidChannel=0) then do
SWITCHER(M003)
SWITCHER(P003)
grab=IQ30
end
else do
SWITCHER(M004)
SWITCHER(P004)
grab=IQ40
end
/*-----------*/
address command
'c:copy >nil: 'FLYER'SetFloobyCal RAM: quiet'
FLYER'playclip >nil: 0 'VidChannel' 0 'TestClip' 0 0 0 1 0'
'RAM:SetFloobyCal >nil: 'VidChannel' 2 0 0 0 0'
address
/*-----------*/
result=SWITCHER(value(grab))
parse value result with 1 YPI +4 YPQ +4 YNI +4 YNQ +4
I0= c2d(YPI)-c2d(YNI)
Q0= c2d(YPQ)-c2d(YNQ)
Ivect=I0/324
Qvect=Q0/324
saturation=squareroot((Ivect*Ivect)+(Qvect*Qvect))
/* check for at least 20 digital units of saturation (ideal=64) */
if(saturation < 20) then do
satpercent =(saturation*100)/64
say "Flyer clip is playing with insufficient saturation."
say "Saturation ="satpercent" percent"
say "You may want to power down, and then try again."
GetOutaHere("If the problem persists, contact NewTek for help.")
end
/*----------*/
SWITCHER(DIIM) /* disable imagery */
QabsBest= 500000000 /* bogus initial value */
Position=-35
do until ((PlayPhaseError < 3) | (Position=0))
if(Position=-34) then posit="ffde"
else if(Position=-35) then posit="ffdd"
else if(Position=-36) then posit="ffdc"
/* set play position */
address command
'RAM:SetFloobyCal >nil: 'VidChannel' 5 0 'posit
address
do clock=0 to 3
do coarse=0 to 9
do fine=0 to 7
address command
'RAM:SetFloobyCal >nil: 'VidChannel' 2 0 'clock coarse fine
address
result=SWITCHER(value(grab))
parse value result with 1 YPI +4 YPQ +4 YNI +4 YNQ +4
I0= c2d(YPI)-c2d(YNI)
Q0= c2d(YPQ)-c2d(YNQ)
Qabs = abs(Q0)
if((Qabs < QabsBest) & (I0 > 0)) then do
PositionBest=Position
positBest=posit
Ibest=I0
Qbest=Q0
QabsBest=Qabs
ClockBest=clock
CoarseBest=coarse
FineBest=fine
end
end fine
end coarse
end clock
if(Position=-35) then Position=-34
else if(Position=-34) then Position=-36
else if(Position=-36) then Position=0
PlayPhaseError = IQ2Hue(Ibest,Qbest)
end
SWITCHER(ENIM) /* enable imagery */
/* say "Clock Coarse Fine ="PositionBest ClockBest CoarseBest FineBest */
if(abs(PlayPhaseError) > 3) then do
say "Problem detected during Flyer Play Phase calibration."
say "Play Phase error ="PlayPhaseError" degrees."
say "Please power down, and then try again."
GetOutaHere("If the problem persists, contact NewTek for help.")
end
/* save it in non-volatile memory */
address command
'RAM:SetFloobyCal >nil: 'VidChannel' 5 1 'positBest
'RAM:SetFloobyCal >nil: 'VidChannel' 2 1 'ClockBest CoarseBest FineBest
'c:delete >nil: RAM:SetFloobyCal quiet'
address
return (PlayPhaseError)
/******************************************************************/
/******************************************************************/
ConnectLoopBack:
abort=FALSE
SWITCHER(TOSW)
do while((abort=FALSE) & (SWITCHER(STAT,V2IS) = 0))
SWITCHER(TOWB)
say "Please connect the output of your Toaster to the Toasters Input 2."
say "Please press <RETURN> when ready. (or enter 'A' to abort)"
pull myhair
if (left(myhair,1) = "A") then do
abort=TRUE
say "WARNING!"
say "Toaster Digital Hue adjustment has been aborted."
say "Your Flyer's playback phase may not be calibrated correctly!"
end
SWITCHER(TOSW)
end
return(abort)
/******************************************************************/
/******************************************************************/
CaliDigitalPhase:
abserr=130000 /* bogus error */
do dp=0 to 63
SWITCHER(DHUE,dp)
/* SWITCHER(M003) */
dperr=SWITCHER(DH3E) /* signed error */
absdp=abs(dperr)
if(absdp < abserr) then do
error=dperr
abserr=absdp
best=dp
end
end
/* say "BestDP="best" Error="error */
return(best)
/******************************************************************/
/******************************************************************/
/* -180 < result < 180 degrees */
polar: procedure
arg opposite,adjacent
if adjacent = 0 then do
if opposite < 0 then return 270
else return 90
end
remlib("ToasterARexx.port")
addlib("rexxmathlib.library",0,-30,0)
result = 57.29578*atan(opposite/adjacent)
remlib("rexxmathlib.library")
addlib("ToasterARexx.port",0)
if adjacent < 0 then result = result + 180
return result
/******************************************************************/
/******************************************************************/
IQ2Hue: procedure
arg ip,qp
hue = polar(-qp,ip) /* return degrees from I vector */
return hue
/******************************************************************/
/******************************************************************/
DeltaHue2Angle: procedure
arg foo
foo = foo/65536
if (( foo > 1.0 ) | (foo < -1.0)) then result = 3.1416*sign(foo) + arcsine(foo-2*sign(foo))
else result = arcsine(foo)
return 57.29578*result
/******************************************************************/
squareroot: procedure
arg param
remlib("ToasterARexx.port")
addlib("rexxmathlib.library",0,-30,0)
result = sqrt(param)
remlib("rexxmathlib.library")
addlib("ToasterARexx.port",0)
return result
/******************************************************************/
arcsine: procedure
arg param
remlib("ToasterARexx.port")
addlib("rexxmathlib.library",0,-30,0)
result = asin(param)
remlib("rexxmathlib.library")
addlib("ToasterARexx.port",0)
return result
/******************************************************************/
/******************************************************************/
GetOutaHere:
parse arg message
SWITCHER(TOSW)
SWITCHER(NOIQ)
SWITCHER(TOWB)
say message
/**********
if(TestClip ~= "") then do
say "Would you like me to delete the "TestClip" clip (Y/N)?"
pull myhair
if (left(myhair,1) ~= "N") then do
address command
'c:delete >nil: 'TestClip' quiet'
address
end
end
else do
say "Press <RETURN> to exit."
pull myhair
end
**********/
say "Press <RETURN> to exit."
pull myhair
remlib("ToasterARexx.port")
exit()
return